﻿/******************************************************************************
 * 
 * Announce: CSharpKit, Basic algorithms, components and definitions.
 *           Copyright (C) ShenYongchen.
 *           All rights reserved.
 *   Author: 申永辰.郑州 (shenyczz@163.com)
 *  WebSite: http://github.com/shenyczz/CSharpKit
 *
 * THIS CODE IS LICENSED UNDER THE MIT LICENSE (MIT).
 * THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 
 * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
 * IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
 * PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
 * 
******************************************************************************/

using System;
using CSharpKit.Numerics.LinearAlgebra.Factorization;
using CSharpKit.Numerics.LinearAlgebra.Factorization.Doubles;

namespace CSharpKit.Numerics.LinearAlgebra.Doubles
{
    /// <summary>
    /// Double Matrix
    /// </summary>
    [Serializable]
    public class Matrix : Matrix<double>
    {
        protected Matrix(MatrixStorage<double> storage)
            : base(storage) { }



        // public override Cholesky<double> Cholesky()
        // {
        //     return CholeskyDense.Create(this);
        // }


        // Factorizations - 因式分解

        public override Cholesky<double> Cholesky()
        {
            return UserCholesky.Create(this);
        }










        public override void CoerceZero(double threshold)
        {
            MapInplace(x => System.Math.Abs(x) < threshold ? 0d : x, Zeros.AllowSkip);
        }



        //}}@@@
    }

}

